package com.memoryangelapplication;
/*
 * SQLite Database Version Controllers*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MemoryAngelDBLoader extends SQLiteOpenHelper {

	// Database Name
	private static final String DATABASE_NAME = "memoryangel.db";
	// Master Tables
	private String MEM_USER = "table_user";
	private String MEM_EVENT = "table_events";
	private String MEM_DEVICE = "table_device";

	// Database Version
	private static final int DATABASE_VERSION = 1;
	private static final String TAG = null;

	public MemoryAngelDBLoader(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		// this.myContext = context;
	}

	@Override
	public void onCreate(SQLiteDatabase mydb) {
		try {
			Log.v(TAG, "onCreate Call");
			mydb.execSQL("create table if not exists "
					+ MEM_USER
					+ "(user_id integer primary key autoincrement,user_carer_id text not null,user_carer_email text not null,user_carer_name text not null,user_carer_sms text not null,user_op_id text not null,user_op_name text not null,user_reg_date text not null,user_secreat text not null);");


			mydb.execSQL("create table if not exists "
					+ MEM_EVENT
					+ "(_id integer primary key autoincrement,event_log_id text not null,event_user_id text not null,event_title text not null,event_description text not null,event_status text not null,event_date text not null,event_time text not null,event_alam_time text not null,event_active text not null,event_user_phoneno text not null,event_url text not null,event_package text not null,event_time_stamp text not null,event_update_time text not null,event_ack_count text not null,eventReminderTime text not null,eventReminderNumber text not null,eventWaitTime text not null,eventNotifyType text not null,eventTimeStamp text not null);");

			mydb.execSQL("create table if not exists "
					+ MEM_DEVICE
					+ "(device_id integer primary key autoincrement,device_emi text not null,device_lon text not null,device_lat text not null,device_valume text not null,device_battery text not null,device_update_time text not null);");


		} catch (Exception e) {
		}

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// on upgrade drop older tables

	}

}
